package com.huijy.web.controller.monitor;

import com.huijy.management.service.IContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huijy.common.core.domain.AjaxResult;
import com.huijy.framework.web.domain.Server;

/**
 * 服务器监控
 *
 * @author huijy
 */
@RestController
@RequestMapping("/monitor/server")
public class ServerController {

    @Autowired
    private IContentService contentService;

    @PreAuthorize("@ss.hasPermi('monitor:server:list')")
    @GetMapping()
    public AjaxResult getInfo() throws Exception {
        Server server = new Server();
        server.copyTo();
        return AjaxResult.success(server);
    }

    /**
     * 后台UI首页数据统计
     *
     * @return
     */
    @GetMapping(value = "/home")
    public AjaxResult home() {
        return AjaxResult.success(contentService.statistics());
    }
}
